﻿using Forum.BaseController;
using Forum.Infrastructure.Util;
using Forum.Model;
using Forum.Service.Interface;

namespace Forum.ForeignController
{
    [ApiController]
    [Route("Api/[controller]")]
    public class TestController : ForeignController<IBaseService>
    {
        public TestController(IBaseService defaultService, ILogger<ForeignController<IBaseService>> logger) : base(defaultService, logger)
        {
        }

        [HttpGet]
        public string Hello()
        {
            Log.LogInformation("==进入方法==");

            IdGeneratorHelper idHelper = new IdGeneratorHelper();
            Console.WriteLine(idHelper.GetId());
            Console.WriteLine(idHelper.GetId());
            Console.WriteLine(idHelper.GetId());


            Snowflake snowflake = new Snowflake(1, 1);
            Console.WriteLine(snowflake.NextId());
            Console.WriteLine(snowflake.NextId());
            Console.WriteLine(snowflake.NextId());


            SnowflakeHelper snow = new SnowflakeHelper();
            Console.WriteLine(snow.NextId());
            Console.WriteLine(snow.NextId());
            Console.WriteLine(snow.NextId());


            #region 测试缓存

            Console.WriteLine(SystemConfig.imageUrl);

            //CacheFactory.Cache.SetCache("name", "world");
            //var aa = CacheFactory.Cache.GetCache<string>("name");
            //Console.WriteLine(aa);

            #endregion

            return SystemConfig.imageUrl;
        }


    }
}
